#include <stdio.h>
#include <sys/shm.h>
#include <sys/ipc.h>



#define PATH_NAME "."
#define SZ 64
#define PROJ_ID 100

// 创建一个共享内存， 并打印出共享内存ID
int main(int argc, char const *argv[])
{
    
    int ret;
    key_t key = ftok(PATH_NAME, PROJ_ID);
    if (key == -1) {
        perror("ftok failed");
        printf("ftok failed \n");
    }
    // 
    int shmid = shmget(key, SZ, 0666|IPC_CREAT);
    if (shmid == -1) {
        perror("shmget failed");
        printf("shmget failed \n");
    }
    printf("shmid = %d\n", shmid);
    return 0;
}
